package study.alex.resumedb.gae;

import com.vaadin.addon.jpacontainer.JPAContainerFactory;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public final class EMF {
    public static final String PERSISTENCE_UNIT = "transactions-optional";

    private static final EntityManagerFactory emfInstance =
            Persistence.createEntityManagerFactory(PERSISTENCE_UNIT);

    private EMF() {}

    public static EntityManagerFactory get() {
        return emfInstance;
    }

    public static EntityManager getEntityManager() {
//        return JPAContainerFactory.createEntityManagerForPersistenceUnit(PERSISTENCE_UNIT);
        return emfInstance.createEntityManager();
    }
}